import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

import { LoginComponent } from './pages/login/login.component';
import { HomeComponent } from './pages/home/home.component';
import { IndexComponent } from './pages/index/index.component';
import { CourseComponent } from './pages/index/course/course.component';
import { SelectedCoursesComponent } from './pages/index/selected-courses/selected-courses.component';

const routes: Routes = [
  { path: 'login', component: LoginComponent },
  { path: 'home', component: HomeComponent },
  {
    path: '',
    component: IndexComponent,
    children: [
      {
        path: 'choose-courses',
        component: CourseComponent
      },
      {
        path: 'selected-courses',
        component: SelectedCoursesComponent
      },
      {
        path: '',
        redirectTo: '/choose-courses',
        pathMatch: 'full'
      }
    ]
  }
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule {}
